using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace Colman.Rpg.Controls
{
    /// <summary>
    /// The small character sheet in battles.
    /// </summary>
    public partial class BattleCharacterSheetControl : UserControl
    {
        /// <summary>
        /// Creates a new instance of <see cref="BattleCharacterSheetControl" />.
        /// </summary>
        public BattleCharacterSheetControl()
        {
            InitializeComponent();
        }

        #region Character DataSource { get; set; } (dataSource)
        private Character dataSource;

        /// <summary>
        /// Gets or sets the data source for the information.
        /// </summary>
        [System.ComponentModel.Description("Indicates the data source for the information.")]
        public Character DataSource
        {
            [System.Diagnostics.DebuggerStepThrough]
            get
            {
                return this.dataSource;
            }
            set
            {
                if (this.dataSource != value)
                {
                    this.dataSource = value;

                    if (this.dataSource != null)
                    {
                        this.lblCharacterName.Text = this.dataSource.Name;
                        this.lblAttack.Text = this.dataSource.CombinedAP.ToString();
                        this.lblDefense.Text = this.dataSource.CombinedDP.ToString();
                        this.lblHealth.Text = this.dataSource.HP.ToString();
                        if (dataSource.GetType() == typeof(Player))
                        {
                            Player pl = dataSource as Player;
                            this.lblexperience.Text = pl.XP.ToString();
                            this.lblLevel.Text = pl.Level.ToString();
                        }
                        else
                        {
                            this.lblexperience.Hide();
                            this.lblExperienceText.Hide();
                            this.lblLevel.Hide();
                            this.lblLevelText.Hide();
                        }
                    }
                }
            }
        }
        #endregion
    }
}
